package com.spider.job;

import com.aliyun.oss.OSS;
import com.spider.oss.FileInfo;
import com.spider.oss.OssJavaSdkQuickStart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class OssJobTask {
    private final Logger logger = LoggerFactory.getLogger(OssJobTask.class);

    @Autowired
    OssJavaSdkQuickStart ossJavaSdkQuickStart;
    @Autowired
    private OSS ossClient;
    @Value("${aliyun.oss.bucketName}")
    private String bucketName;
    /**
     * 繁星接口
     */
    //每天2点15执行
    @Scheduled(cron = "0 0 7,22 * * ?")
    public void sendWorkflowHandle() throws Exception {
        // 修改为传入本地目录路径
        List<FileInfo> fileInfos = ossJavaSdkQuickStart.uploadLocalFile(
                "COA_PDF",
                "D:\\COA_PDF",
                ossClient,
                bucketName,
                1000
        );
    }
}
